﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TRON_TheGrid
{
    class Moto : ObjetAnime
    {
        private List<Texture2D> mesTexturesMotos;

        public List<Texture2D> MesTexturesMotos
        {
            get { return mesTexturesMotos; }
            set { mesTexturesMotos = value; }
        }


        public Moto(Game game, Texture2D texture, Vector2 position, Vector2 size, Vector2 vitesse,List<Texture2D> texturesMotos)
            : base(game, texture, position, size,vitesse)
        {
            this.mesTexturesMotos = texturesMotos;
        }
        protected override void LoadContent()
        {
            
            base.LoadContent();
        }
        public override void Update(GameTime gameTime)
        {
            Vector2 nouvelleVitesse = this.Vitesse;
            if (nouvelleVitesse.X == 0)
            {
                if (nouvelleVitesse.Y >= 0) nouvelleVitesse.Y += 0.1F;
                else nouvelleVitesse.Y -= 0.1F;
            }
            else
            {
                if (nouvelleVitesse.X >= 0) nouvelleVitesse.X += 0.1F;
                else nouvelleVitesse.X -= 0.1F;
            }
            this.Vitesse = nouvelleVitesse;


            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            Vector2 pos=this.Position;
            if (pos.X == 0)
            {
                if (pos.Y < 0) this.Texture = mesTexturesMotos[0];
                else this.Texture = mesTexturesMotos[1];
            }
            else 
            {
                if (pos.X < 0) this.Texture = mesTexturesMotos[2];
                else this.Texture = mesTexturesMotos[3];
            }
          
            base.Draw(gameTime);
        }
    }
}
